﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;

namespace MethodWorx.CMS.Plugins
{
    [Serializable]
    public class LinkPropertyDetails : ICustomPropertyDetails
    {
        [Required]
        public LinkType LinkType { get; set; }
        public string LinkUrl { get; set; }

        public void CopyValueFrom(ICustomPropertyDetails from)
        {
            var lpd = from as LinkPropertyDetails;
            if (lpd != null)
            {
                this.LinkType = lpd.LinkType;
                this.LinkUrl = lpd.LinkUrl;
            }
        }

        #region ICustomPropertyDetails Members


        public void Parse(string input)
        {
            this.LinkUrl = input;
        }

        #endregion

        public object Clone()
        {
            return this.MemberwiseClone();
        }

        public bool IsNull()
        {
            return string.IsNullOrEmpty(this.LinkUrl);
        }

        public bool IsEmpty()
        {
            return string.IsNullOrEmpty(this.LinkUrl);
        }

    }
}
